package com.program.cloudmanagesystem.hotel.persistence;
import com.program.cloudmanagesystem.hotel.domain.Vehicle;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
public interface VehicleMapper {
    @Select("select * from vehicle")
    List<Vehicle> showVehicles();
    @Select("select * from vehicle where vehicle.lisence = #{lisence}")
    Vehicle searchVehicle(String lisence);
    @Insert("insert into vehicle(id,lisence,style,base,date,hotelid) values (#{id},#{lisence},#{style},#{base},#{date},#{hotelid})")
    void insertVehicle(@Param("id") int id,@Param("lisence") String lisence,@Param("style") String style,@Param("base") String base,@Param("date") String date,@Param("hotelid") String hotelid);
    @Delete("delete from vehicle where id = #{id}")
    void deleteVehicle(int id);
    @Update("update vehicle set lisence = #{lisence},style = #{style},base = #{base},date = #{date} Where id = #{id}")
    void updateData(@Param("id") int id,@Param("lisence") String lisence,@Param("style") String style,@Param("base") String base,@Param("date") String date,@Param("hotelid") String hotelid);
    @Select("select * from vehicle where vehicle.hotelid = #{hotelId}")
    List<Vehicle> showVehiclesByHotelId(String hotelId);
}
